using RxjhServer.DbClss;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace RxjhServer
{
	public class FormUser组队 : Form
	{
		private ListView listView1;

		private ColumnHeader columnHeader5;

		private ColumnHeader columnHeader1;

		private SplitContainer splitContainer1;

		private ListView listView2;

		private ColumnHeader columnHeader2;

		private ColumnHeader columnHeader3;

		private ColumnHeader columnHeader4;

		private ColumnHeader columnHeader6;

		private ColumnHeader columnHeader9;

		private ColumnHeader columnHeader7;

		private ColumnHeader columnHeader8;

		private ColumnHeader columnHeader10;

		private ColumnHeader columnHeader11;

		private ColumnHeader columnHeader12;

		private ColumnHeader columnHeader14;

		private ColumnHeader columnHeader13;

		private ColumnHeader columnHeader15;

		private ColumnHeader columnHeader16;

		private ColumnHeader columnHeader17;

		private ColumnHeader columnHeader18;

		private ColumnHeader columnHeader20;

		private ColumnHeader columnHeader19;

		private ContextMenu contextMenu1;

		private MenuItem menuItem1;

		private MenuItem menuItem2;

		private MenuItem menuItem3;

		private MenuItem menuItem4;

		private MenuItem menuItem5;

		private MenuItem menuItem6;

		private MenuItem menuItem7;

		private MenuItem menuItem8;

		private MenuItem menuItem9;

		private MenuItem menuItem10;

		private MenuItem menuItem11;

		private MenuItem menuItem12;

		private MenuItem menuItem13;

		public FormUser组队()
		{
			InitializeComponent();
		}

		private void FormUser组队_Load(object sender, EventArgs e)
		{
			foreach (组队Class value in World.W组队.Values)
			{
				string[] array = new string[2];
				try
				{
					array[0] = value.组队id.ToString();
					array[1] = value.组队列表.Count.ToString();
					listView1.Items.Insert(listView1.Items.Count, new ListViewItem(array));
				}
				catch
				{
				}
			}
		}

		private void listView1_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView1.SelectedItems.Count > 0 && World.W组队.TryGetValue(int.Parse(listView1.SelectedItems[0].SubItems[0].Text), out 组队Class value))
				{
					listView2.Items.Clear();
					foreach (Players value2 in value.组队列表.Values)
					{
						string[] array = new string[18];
						try
						{
							foreach (组队顺序类 value3 in value.组队顺序列表.Values)
							{
								if (value3.WorldID == value2.人物全服ID)
								{
									array[0] = value3.ID.ToString();
									break;
								}
							}
							array[1] = value2.人物全服ID.ToString();
							array[2] = value2.Userid;
							array[3] = value2.UserName;
							array[4] = value2.Player_Level.ToString();
							array[5] = value2.人物_HP.ToString();
							if (value2.Client != null)
							{
								array[6] = value2.Client.ToString();
							}
							array[7] = 坐标Class.getmapname(value2.人物坐标_地图);
							array[8] = value2.人物坐标_X.ToString();
							array[9] = value2.人物坐标_Y.ToString();
							array[10] = value2.FLD_人物基本_攻击.ToString();
							array[11] = value2.FLD_追加百分比_攻击.ToString();
							array[12] = value2.FLD_人物基本_防御.ToString();
							array[13] = value2.FLD_追加百分比_防御.ToString();
							array[14] = value2.FLD_装备_追加_气功.ToString();
							array[15] = value2.FLD_装备_追加_武器_强化.ToString();
							array[16] = value2.FLD_装备_追加_防具_强化.ToString();
							if (value2.Player_Job > 0 && value2.Player_Job <= 5)
							{
								if (value2.Player_Job == 1)
								{
									array[17] = "刀";
								}
								if (value2.Player_Job == 2)
								{
									array[17] = "剑";
								}
								if (value2.Player_Job == 3)
								{
									array[17] = "枪";
								}
								if (value2.Player_Job == 4)
								{
									array[17] = "弓";
								}
								if (value2.Player_Job == 5)
								{
									array[17] = "医";
								}
							}
						}
						catch
						{
							array[1] = value2.人物全服ID.ToString();
							array[2] = value2.Userid;
							array[3] = value2.UserName;
							array[4] = value2.Player_Level.ToString();
						}
						listView2.Items.Insert(listView2.Items.Count, new ListViewItem(array));
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "组队列表出错" + ex.Message);
			}
		}

		private void InitializeComponent()
		{
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RxjhServer.FormUser组队));
			contextMenu1 = new System.Windows.Forms.ContextMenu();
			menuItem1 = new System.Windows.Forms.MenuItem();
			menuItem2 = new System.Windows.Forms.MenuItem();
			menuItem3 = new System.Windows.Forms.MenuItem();
			menuItem4 = new System.Windows.Forms.MenuItem();
			menuItem5 = new System.Windows.Forms.MenuItem();
			menuItem6 = new System.Windows.Forms.MenuItem();
			menuItem7 = new System.Windows.Forms.MenuItem();
			menuItem8 = new System.Windows.Forms.MenuItem();
			menuItem9 = new System.Windows.Forms.MenuItem();
			menuItem10 = new System.Windows.Forms.MenuItem();
			menuItem11 = new System.Windows.Forms.MenuItem();
			menuItem12 = new System.Windows.Forms.MenuItem();
			menuItem13 = new System.Windows.Forms.MenuItem();
			listView1 = new System.Windows.Forms.ListView();
			columnHeader5 = new System.Windows.Forms.ColumnHeader();
			columnHeader1 = new System.Windows.Forms.ColumnHeader();
			splitContainer1 = new System.Windows.Forms.SplitContainer();
			listView2 = new System.Windows.Forms.ListView();
			columnHeader2 = new System.Windows.Forms.ColumnHeader();
			columnHeader3 = new System.Windows.Forms.ColumnHeader();
			columnHeader4 = new System.Windows.Forms.ColumnHeader();
			columnHeader6 = new System.Windows.Forms.ColumnHeader();
			columnHeader9 = new System.Windows.Forms.ColumnHeader();
			columnHeader7 = new System.Windows.Forms.ColumnHeader();
			columnHeader8 = new System.Windows.Forms.ColumnHeader();
			columnHeader10 = new System.Windows.Forms.ColumnHeader();
			columnHeader11 = new System.Windows.Forms.ColumnHeader();
			columnHeader12 = new System.Windows.Forms.ColumnHeader();
			columnHeader14 = new System.Windows.Forms.ColumnHeader();
			columnHeader13 = new System.Windows.Forms.ColumnHeader();
			columnHeader15 = new System.Windows.Forms.ColumnHeader();
			columnHeader16 = new System.Windows.Forms.ColumnHeader();
			columnHeader17 = new System.Windows.Forms.ColumnHeader();
			columnHeader18 = new System.Windows.Forms.ColumnHeader();
			columnHeader19 = new System.Windows.Forms.ColumnHeader();
			columnHeader20 = new System.Windows.Forms.ColumnHeader();
			((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
			splitContainer1.Panel1.SuspendLayout();
			splitContainer1.Panel2.SuspendLayout();
			splitContainer1.SuspendLayout();
			SuspendLayout();
			contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[13]
			{
				menuItem1,
				menuItem2,
				menuItem3,
				menuItem4,
				menuItem5,
				menuItem6,
				menuItem7,
				menuItem8,
				menuItem9,
				menuItem10,
				menuItem11,
				menuItem12,
				menuItem13
			});
			menuItem1.Index = 0;
			menuItem1.Text = "退人";
			menuItem1.Click += new System.EventHandler(menuItem1_Click);
			menuItem2.Index = 1;
			menuItem2.Text = "退人Id";
			menuItem2.Click += new System.EventHandler(menuItem2_Click);
			menuItem3.Index = 2;
			menuItem3.Text = "封IP";
			menuItem3.Click += new System.EventHandler(menuItem3_Click);
			menuItem4.Index = 3;
			menuItem4.Text = "封Id";
			menuItem4.Click += new System.EventHandler(menuItem4_Click);
			menuItem5.Index = 4;
			menuItem5.Text = "查数据";
			menuItem5.Click += new System.EventHandler(menuItem5_Click);
			menuItem6.Index = 5;
			menuItem6.Text = "发消息";
			menuItem6.Click += new System.EventHandler(menuItem6_Click);
			menuItem7.Index = 6;
			menuItem7.Text = "禁言";
			menuItem7.Click += new System.EventHandler(menuItem7_Click);
			menuItem8.Index = 7;
			menuItem8.Text = "解除禁言";
			menuItem8.Click += new System.EventHandler(menuItem8_Click);
			menuItem9.Index = 8;
			menuItem9.Text = "概率加5%";
			menuItem9.Click += new System.EventHandler(menuItem9_Click);
			menuItem10.Index = 9;
			menuItem10.Text = "概率加100%";
			menuItem10.Click += new System.EventHandler(menuItem10_Click);
			menuItem11.Index = 10;
			menuItem11.Text = "概率还原";
			menuItem11.Click += new System.EventHandler(menuItem11_Click);
			menuItem12.Index = 11;
			menuItem12.Text = "加爆100倍";
			menuItem12.Click += new System.EventHandler(menuItem12_Click);
			menuItem13.Index = 12;
			menuItem13.Text = "暴率还原";
			menuItem13.Click += new System.EventHandler(menuItem13_Click);
			listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[2]
			{
				columnHeader5,
				columnHeader1
			});
			listView1.Dock = System.Windows.Forms.DockStyle.Fill;
			listView1.ForeColor = System.Drawing.SystemColors.WindowText;
			listView1.FullRowSelect = true;
			listView1.GridLines = true;
			listView1.HideSelection = false;
			listView1.Location = new System.Drawing.Point(0, 0);
			listView1.Name = "listView1";
			listView1.Size = new System.Drawing.Size(1326, 168);
			listView1.TabIndex = 9;
			listView1.UseCompatibleStateImageBehavior = false;
			listView1.View = System.Windows.Forms.View.Details;
			listView1.Click += new System.EventHandler(listView1_Click);
			columnHeader5.Text = "名称";
			columnHeader5.Width = 71;
			columnHeader1.Text = "数据";
			columnHeader1.Width = 90;
			splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
			splitContainer1.Location = new System.Drawing.Point(0, 0);
			splitContainer1.Name = "splitContainer1";
			splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
			splitContainer1.Panel1.Controls.Add(listView1);
			splitContainer1.Panel2.Controls.Add(listView2);
			splitContainer1.Size = new System.Drawing.Size(1326, 372);
			splitContainer1.SplitterDistance = 168;
			splitContainer1.TabIndex = 10;
			listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[18]
			{
				columnHeader2,
				columnHeader3,
				columnHeader4,
				columnHeader6,
				columnHeader9,
				columnHeader7,
				columnHeader8,
				columnHeader10,
				columnHeader11,
				columnHeader12,
				columnHeader14,
				columnHeader13,
				columnHeader15,
				columnHeader16,
				columnHeader17,
				columnHeader18,
				columnHeader19,
				columnHeader20
			});
			listView2.Dock = System.Windows.Forms.DockStyle.Fill;
			listView2.ForeColor = System.Drawing.SystemColors.WindowText;
			listView2.FullRowSelect = true;
			listView2.GridLines = true;
			listView2.HideSelection = false;
			listView2.Location = new System.Drawing.Point(0, 0);
			listView2.Name = "listView2";
			listView2.Size = new System.Drawing.Size(1326, 200);
			listView2.TabIndex = 2;
			listView2.UseCompatibleStateImageBehavior = false;
			listView2.View = System.Windows.Forms.View.Details;
			listView2.MouseClick += new System.Windows.Forms.MouseEventHandler(listView2_MouseClick);
			columnHeader2.Text = "序号";
			columnHeader2.Width = 36;
			columnHeader3.Text = "ID";
			columnHeader3.Width = 66;
			columnHeader4.Text = "账号";
			columnHeader4.Width = 98;
			columnHeader6.Text = "角色";
			columnHeader6.Width = 78;
			columnHeader9.Text = "等级";
			columnHeader9.Width = 47;
			columnHeader7.Text = "HP";
			columnHeader7.Width = 66;
			columnHeader8.Text = "IP";
			columnHeader8.Width = 105;
			columnHeader10.Text = "地图";
			columnHeader10.Width = 61;
			columnHeader11.Text = "X";
			columnHeader11.Width = 61;
			columnHeader12.Text = "Y";
			columnHeader12.Width = 62;
			columnHeader14.Text = "基本攻击";
			columnHeader14.Width = 64;
			columnHeader13.Text = "追加百分比攻击";
			columnHeader13.Width = 98;
			columnHeader15.Text = "基本防御";
			columnHeader15.Width = 63;
			columnHeader16.Text = "追加百分比防御";
			columnHeader16.Width = 99;
			columnHeader17.Text = "追加气功";
			columnHeader17.Width = 64;
			columnHeader18.Text = "追加武器强化";
			columnHeader18.Width = 87;
			columnHeader19.Text = "追加防具强化";
			columnHeader19.Width = 87;
			columnHeader20.Text = "职业";
			columnHeader20.Width = 45;
			base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(1326, 372);
			base.Controls.Add(splitContainer1);
			base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
			base.Name = "FormUser组队";
			Text = "组队列表";
			base.Load += new System.EventHandler(FormUser组队_Load);
			splitContainer1.Panel1.ResumeLayout(false);
			splitContainer1.Panel2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
			splitContainer1.ResumeLayout(false);
			ResumeLayout(false);
		}

		private void menuItem1_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count <= 0)
			{
				return;
			}
			string text = listView2.SelectedItems[0].SubItems[0].Text;
			Players players = World.检查玩家name(text);
			if (players != null)
			{
				if (players.Client.挂机)
				{
					players.OpClient(1);
					players.Client.DisposedOffline();
				}
				else
				{
					players.OpClient(1);
					players.Client.Dispose();
				}
			}
		}

		private void menuItem2_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count <= 0)
			{
				return;
			}
			string text = listView2.SelectedItems[0].SubItems[0].Text;
			Players players = World.检查玩家(text);
			if (players != null)
			{
				if (players.Client.挂机)
				{
					players.OpClient(1);
					players.Client.DisposedOffline();
				}
				else
				{
					players.OpClient(1);
					players.Client.Dispose();
				}
			}
		}

		private void menuItem3_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count > 0)
			{
				string text = listView2.SelectedItems[0].SubItems[0].Text;
				string sqlCommand = " Insert into TBL_BANED values ( '" + text + "')";
				DBA.ExeSqlCommand(sqlCommand, "rxjhaccount");
			}
		}

		private void menuItem4_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count > 0)
			{
				string text = listView2.SelectedItems[0].SubItems[0].Text;
				World.conn.发送("全线登陆提示|玩家[" + text + "]在[" + World.服务器ID.ToString() + "线]违反游戏规则，被系统永久封号,请各位玩家遵守游戏规则！|通告");
				string text2 = listView2.SelectedItems[0].SubItems[1].Text;
				Players players = World.检查玩家(text2);
				players.系统公告("玩家[" + text + "]在[" + World.服务器ID.ToString() + "线]违反游戏规则，被系统永久封号, 请各位玩家遵守游戏规则！");
				players.系统提示("由于您违反游戏规则，被系统封号，请联系客服。", 20, "封号");
				Players players2 = World.检查玩家name(text);
				players.OpClient(1);
				players.Client.Dispose();
				string text3 = listView2.SelectedItems[0].SubItems[0].Text;
				string sqlCommand = "UPDATE TBL_ACCOUNT SET FLD_ZT=1 WHERE FLD_ID='" + text3 + "'";
				DBA.ExeSqlCommand(sqlCommand, "rxjhaccount");
				Form1.WriteLine(1, "手动封号 - 用户踢出ID [" + players.Userid + "]-[" + players.UserName + "]" + players.Client.ToString());
			}
		}

		private void menuItem5_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count > 0)
			{
				string text = listView2.SelectedItems[0].SubItems[0].Text;
				UserIdList userIdList = new UserIdList();
				userIdList.username = text;
				userIdList.ShowDialog();
			}
		}

		private void menuItem6_Click(object sender, EventArgs e)
		{
			if (listView2.SelectedItems.Count > 0)
			{
				sendmsg.SetName(listView2.SelectedItems[0].SubItems[0].Text);
				int num = (int)new sendmsg().ShowDialog();
			}
		}

		private void menuItem7_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.禁言分钟 != 1)
					{
						players.禁言分钟 = 1;
						players.保存人物的数据();
						players.系统提示("由于您严重违规，已被客服禁言", 20, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 21, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 20, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 22, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 20, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 24, "禁言");
						players.系统提示("由于您严重违规，已被客服禁言", 20, "禁言");
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]已被禁言");
					}
					else
					{
						Form1.WriteLine(3, "[账号:" + players.Userid + "][角色:" + text + "]已被禁言,无需重复操作！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "禁言分钟出错[" + ex.Message + "]");
			}
		}

		private void menuItem8_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.禁言分钟 != 0)
					{
						players.禁言分钟 = 0;
						players.保存人物的数据();
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						players.系统提示("禁言已解除,可以自由发言啦", 10, "禁言解除");
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]已解除禁言");
					}
					else
					{
						Form1.WriteLine(3, "[账号:" + players.Userid + "][角色:" + text + "]已解除禁言,无需重复操作！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "解除禁言出错[" + ex.Message + "]");
			}
		}

		private void menuItem9_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.手动追加概率 < 1.0)
					{
						players.手动追加概率 += 0.05;
						Form1.WriteLine(10, "[账号:" + players.Userid + "][角色:" + text + "]加概率5% 成功");
					}
					else
					{
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]概率已满,无需添加！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "手动追加概率出错[" + ex.Message + "]");
			}
		}

		private void menuItem10_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.手动追加概率 < 1.0)
					{
						players.手动追加概率 = 1.0;
						Form1.WriteLine(10, "[账号:" + players.Userid + "][角色:" + text + "]概率加100% 成功");
					}
					else
					{
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]概率已满,无需添加！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "手动追加概率出错[" + ex.Message + "]");
			}
		}

		private void menuItem11_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.手动追加概率 != 0.0)
					{
						players.手动追加概率 = 0.0;
						Form1.WriteLine(10, "[账号:" + players.Userid + "][角色:" + text + "]概率还原 成功");
					}
					else
					{
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]概率已是默认,无需还原！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "手动追加概率出错[" + ex.Message + "]");
			}
		}

		private void menuItem12_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.手动追加爆率 + (double)World.暴率 < 10000.0)
					{
						players.手动追加爆率 += 100.0;
						Form1.WriteLine(10, "[账号:" + players.Userid + "][角色:" + text + "]-爆100倍 成功");
					}
					else
					{
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]爆率已满,无需添加！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "手动追加爆率出错[" + ex.Message + "]");
			}
		}

		private void menuItem13_Click(object sender, EventArgs e)
		{
			try
			{
				if (listView2.SelectedItems.Count > 0)
				{
					string text = listView2.SelectedItems[0].SubItems[0].Text;
					Players players = World.检查玩家name(text);
					if (players.手动追加爆率 != 0.0)
					{
						players.手动追加爆率 = 0.0;
						Form1.WriteLine(10, "[账号:" + players.Userid + "][角色:" + text + "]爆率还原 成功");
					}
					else
					{
						Form1.WriteLine(1, "[账号:" + players.Userid + "][角色:" + text + "]爆率已是默认,无需还原！");
					}
				}
			}
			catch (Exception ex)
			{
				Form1.WriteLine(1, "手动追加爆率出错[" + ex.Message + "]");
			}
		}

		private void listView2_MouseClick(object sender, MouseEventArgs e)
		{
			listView2.MultiSelect = false;
			if (e.Button == MouseButtons.Right)
			{
				Point pos = new Point(e.X, e.Y);
				contextMenu1.Show(listView2, pos);
			}
		}
	}
}
